package com.mjh.zhujianju.enums;

/**
 * 是否
 *@ClassName: YesNOEnum 
 * @Description 
 * @author wangdong
 * @date 2018年8月19日 下午12:19:17   
 * @version V1.0
 */
public enum YesNOEnum {
	YES("1","是"),
    NO("2","否");


    private String code;
    private String name;

    YesNOEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static YesNOEnum[] getEnums(){
        return YesNOEnum.values();
    }

    public static String getName(String code){
        if(code == null){
            return null;
        }

        for (YesNOEnum YesNOEnum : YesNOEnum.values()){
            if(code.equals(YesNOEnum.getCode())){
                return YesNOEnum.getName();
            }
        }

        return null;
    }
}
